//
//  RecordView.m
//  BaiYing_Thinker
//
//  Created by 鹏 朱 on 15/10/29.
//  Copyright (c) 2015年 XKJH. All rights reserved.
//

#import "RecordView.h"

@implementation RecordView

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        // Initialization code
        self.backgroundColor = [UIColor blackColor];
        self.alpha = 0.8;
        self.layer.masksToBounds = YES;
        self.layer.cornerRadius = 10;
        
        UIImageView *animateView = [[UIImageView alloc] initWithFrame:CGRectMake(43, 9, 75, 111)];
        [self addSubview:animateView];
        self.animateView = animateView;
        
        UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(12, 128, 136, 21)];
        title.text = @"上滑手指，取消发送";
        title.textAlignment = NSTextAlignmentCenter;
        title.textColor = [UIColor whiteColor];
        title.backgroundColor = [UIColor clearColor];
        title.font = [UIFont systemFontOfSize:14];
        [self addSubview:title];
        self.title = title;
    }
    return self;
}

- (void)updateAnimateViewWithVolume:(CGFloat)volume
{
    if (0 < volume <= 0.14) {
        [_animateView setImage:[UIImage imageNamed:@"msg_record_02"]];
    }else if (0.14 < volume <= 0.28) {
        [_animateView setImage:[UIImage imageNamed:@"msg_record_04"]];
    }else if (0.28 < volume <= 0.42) {
        [_animateView setImage:[UIImage imageNamed:@"msg_record_06"]];
    }else if (0.42 < volume <= 0.56) {
        [_animateView setImage:[UIImage imageNamed:@"msg_record_08"]];
    }else if (0.56 < volume <= 0.7) {
        [_animateView setImage:[UIImage imageNamed:@"msg_record_10"]];
    }else if (0.7 < volume <= 0.84) {
        [_animateView setImage:[UIImage imageNamed:@"msg_record_12"]];
    }else {
        [_animateView setImage:[UIImage imageNamed:@"msg_record_14"]];
    }
}

@end
